#!/usr/bin/env python
# -*- coding: utf-8 -*-

from __future__ import print_function
import os
import time

from model import Song
from api import XinliFMApi

api = XinliFMApi()


def get_songs_list_by_ids(songids):
    return [Song.parse(api.get_song_info(i)) for i in songids]


def check_dir(path):
    if not os.path.exists(path):
        os.mkdir(path)


def format_time(seconds):
    return time.strftime('%M:%S', time.gmtime(seconds))


def time_past_percent(current, total):
    return current * 100 / total


if __name__ == '__main__':
    pass
